let duration = 1800
setInterval(function () {
    const downTime = document.querySelector('.down-time')
    duration--
    let m = parseInt(duration % 3600 / 60)
    m = m < 10 ? '0' + m : m
    let s = parseInt(duration % 60)
    s = s < 10 ? '0' + s : s
    downTime.innerHTML = `${m}分${s}秒`
}, 1000)
const mes = localStorage.getItem("mes")
const up_address = JSON.parse(mes)
let addArr = []
addArr.push(...up_address)
function render(arr) {
    const newArr = arr.filter(e => e.checked === true)
    const amount = newArr.reduce((prev, item) => prev + +item.goodsPrice, 0)
    document.querySelector(".money").innerHTML = amount
}

render(addArr)
shoppingsss(goodArr)


let username = localStorage.getItem("uname")

const li1 = document.querySelector(".xtx_navs li:nth-child(1)")
const li2 = document.querySelector(".xtx_navs li:nth-child(2)")
if (username) {
    li1.innerHTML = `<a href="javascript:;"><i class="iconfont icon-user">${username}</i></a>`
    li2.innerHTML = '<a href="javascript:;">退出登录</a>'
} else {
    li1.innerHTML = '<a href="../html/login.html">请先登录</a>'
    li2.innerHTML = '<a href="../html/register.html">免费注册</a>'
}
// 退出登录
li2.addEventListener("click", function () {
    // 退出登录
    //  删除localStroage的uuu的数据
    localStorage.removeItem("uname")
    location.reload(true)
})